Skip to content

fix(fields): a dependsOn lookup filters by a populated parent's id, not "[object Object]" - #36938

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/issue-36837-dependson-lookup-id
Nov 24, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/issue-36837-dependson-lookup-id

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #36837

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户在记录详情页(以及编辑弹窗)里点一个依赖上级查找字段的选择器(例如报价单的「联系人」按所属客户过滤)时,原来永远显示「未找到选项」,现在能列出该客户下的联系人。
  • 属于表单级联选择(依赖字段过滤)这一核心能力,替产品负责人报告的报价单场景解决。
  • 若有误,最坏情况是依赖过滤取错值导致选择器为空,与修复前相同;改动只在一处,可直接撤回。
  • 无。

What changes

A lookup with dependsOn naming another lookup builds its candidate filter from the record the host hands it (dependentValues). A record page hands the record as the server returned it, so the parent lookup arrives populated ({ id, name, … }). The one place that turns that record into the filter, LookupField's dependentFilter memo, did String(v) on it. The request then carried ["crm_account","=","[object Object]"] and the picker never matched.

dependentFilter now collapses the parent value through collapseReference. That is the rule lookupRecordReference.ts already applies to { $record } filter comparands ("an expanded row collapses to its id"), now exported so both candidate-filter readers share it. It is fixed at that one producer. All four candidate surfaces read the same memo, so all four are fixed: the quick-select popover, the Level-2 table picker, the PeoplePicker and the create-new seed (initialValues / inline create). The fix applies whatever the host is: detail inline edit, header highlight, in-place editor or the record form. A bare-id parent is unchanged.

Files:

  • ui/packages/fields/src/widgets/LookupField.tsx: the dependentFilter memo collapses each parent value; an import is added.
  • ui/packages/fields/src/widgets/lookupRecordReference.ts: collapseReference is exported and its doc names both readers.
  • ui/packages/fields/src/widgets/LookupField.dependsOn.test.tsx: a new top-level describe in the existing dependsOn harness.
  • .changeset/36837-dependson-lookup-id.md: @object-ui/fields patch.

Tests

  • New pin "a populated dependsOn parent scopes by its id (objectstack#36837)":
    • The populated parent { account: { id: 'a1', name: 'Acme' } } must put $filter.account === 'a1' on every find call, and the list must show only that account's contact.
    • Control: the same parent passed as a bare id sends the identical filter.
  • Red before the fix: expected '[object Object]' to be 'a1', the card's captured request reproduced (1 failed | 10 passed).
  • Green after the fix: the five dependsOn / record-reference LookupField files pass, 39/39. The whole ui/packages/fields/ suite passes at e19a6b2: Test Files 326 passed | 1 skipped, Tests 4982 passed | 7 skipped.
  • Ablation, one run at e19a6b2 through scripts/ablation-replace.mjs:
    • The mutation dropped collapseReference(...) from the memo and landed: anchor 1 → 0, blob c7c449f → 71cd8a0.
    • The new pin went red with Received: "[object Object]".
    • The restore was verified: the blob equals HEAD's c7c449f and git diff HEAD is empty.
    • The test imports ./LookupField from source, so no dist rebuild was needed.

Acceptance notes

Verification

First file to read: LookupField.tsx, the dependentFilter memo. It is the only risky part of the change.

Two-minute check: pnpm --dir ui exec vitest run packages/fields/src/widgets/LookupField.dependsOn.test.tsx should show 11 passed.

Seat-written open. Seat repo:objectstack#4 (os-justin, session_01QSeKYpEsWWE9Y5YtSsDgqZ) opened this draft on the maintainer's ruling in the seat session, verbatim 「一选1+」 (2026-11-24): option 1+ — the seat performs only the writes the dev session's permission classifier refused, each checked against the branch; pull requests stay draft; no standing allow rule is added (evidence card #36936). Refused once in dev session session_01QSeKYq2vSKPUSvT9fXdzEY, reason [Undermining Oversight]: node scripts/pm/fleet-write/dispatch.mjs --repo objectstack-ai/objectstack --actions-file FILE carrying this one pr_create. Title and body above are the dev's text, unchanged; branch head checked at e19a6b25 (4 files, +84 −3; the LookupField.tsx change read against the body).


Generated by Claude Code

The dependent-lookup filter stringified a populated parent row into
"[object Object]", so a record page's dependent picker never found options.
It now collapses the parent through the same rule the `{ $record }` filter
comparands already use.

Claude-Session: https://claude.ai/code/session_01QSeKYq2vSKPUSvT9fXdzEY
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/s documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 24, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ

席位核对 — ACCEPT · L1 · head 3be148898e77f4fb0c912f8833ad08be6644d152 · 2026-11-24T10:43Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ

Landing · 2026-11-24T10:43Z · head 3be148898e77f4fb0c912f8833ad08be6644d152

Probe Reading
check-governed-merges.mjs --pr 36938 NOT governed — 87 changed lines
landing-k.mjs --pr 36938 CAN'T ANSWER (no Test Core shard on a UI-only PR); manual: 3 first-parent commits on main since the merge base, no shared book under this PR
pr-state.mjs --pr 36938 44 success · 13 expected skip · 0 failed · 0 pending · mergeable_state clean
os-regen drift 0 — no path on the merge=os-regen list

State: L1 ACCEPT at this head (above). pr_ready + auto-merge now; the seat follows it to MERGED and closes out #36837 there.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 24, 2026 10:44
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 24, 2026
Merged via the queue into main with commit 69c3dc4 Nov 24, 2026
58 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-36837-dependson-lookup-id branch November 24, 2026 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/s tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

查找选择器的依赖过滤把 lookup 对象拼成了 "[object Object]":报价详情页选联系人永远「未找到选项」(dependsOn)

2 participants